<template>
  <li>
    {{ todo }}
    <button @click="removeTodo">Remove</button>
  </li>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue';

const props = defineProps({
  todo: String,
  index: Number
});

const emit = defineEmits(['remove-todo']);

function removeTodo() {
  emit('remove-todo', props.index);
}
</script>

<style scoped>
li {
  display: flex;
  align-items: center;
  margin: 5px 0;
}

li button {
  margin-left: 10px;
  background-color: #90EE90; /* 修改为绿色背景 */
  border: none;
  border-radius: 5px;
}

li button:hover {
  background-color: #76C7C0; /* 悬停时的绿色背景 */
}
</style>